#pragma once
#include "../Memory/MallocExclusive.h"
#include "../Memory/MallocShare.h"

template<class T, typename...Args>
T* NewObject(Args&&... args)
{
	void* mem = MallocExclusive::Get().Malloc(sizeof(T));
	return new (mem) T(std::forward<Args>(args)...);
}

template<class T>
void DeleteObject(T* object)
{
	object->~T();
	MallocExclusive::Get().Free((void*)object);
}

template<class T, typename...Args>
T* NewShare(Args&&... args)
{
	void* mem = MallocShare::Get().Malloc(sizeof(T));
	return new (mem) T(std::forward<Args>(args)...);
}

template<class T>
void DeleteShare(T* object)
{
	object->~T();
	MallocShare::Get().Free((void*)object);
}


